fix(test): [Queue Instrumentation 39] Remove stale Kafka container before startup#5347
Open
adinauer wants to merge 6 commits intofix/kafka-interceptor-lifecycle-tokenfrom
Open
Conversation
Always remove the named Kafka system-test container before starting a new broker. This avoids docker name conflicts after crashed or interrupted runs while still keeping stop_kafka_broker ownership-aware for reused brokers. Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Apr 29, 2026
Open
Open
This was referenced Apr 29, 2026
Open
📲 Install BuildsAndroid
|
…ystem-test-stale-container
…ystem-test-stale-container
…ystem-test-stale-container
…ystem-test-stale-container
When SENTRY_AUTO_INIT=true with the OTel agent, Sentry is initialized early by SentryAutoConfigurationCustomizerProvider before Spring Boot loads application-kafka.properties. Without the env var, queue tracing stays disabled and OTel messaging spans are not mapped to queue.publish/queue.process ops, causing KafkaOtelCoexistenceSystemTest to fail. Co-Authored-By: Claude <noreply@anthropic.com>
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Stack (Queue Instrumentation)
📜 Description
Clean up stale Kafka system-test containers before starting the local broker.
SystemTestRunner.start_kafka_broker()now force-removes the named container up front, even when the current runner instance did not start the previous broker.stop_kafka_broker()stays ownership-aware and still only tears down brokers started by the current run.💡 Motivation and Context
A review comment on the original Kafka console sample PR pointed out that interrupted runs could leave behind a stopped container named
sentry-java-system-test-kafka. The runner tried to clean that up before startup, but the cleanup path returned early wheneverkafka_started_by_runnerwas false, so the nextdocker run --name ...failed with a container-name conflict.This change fixes the stale-container path without changing the reuse behavior for an already running broker on
localhost:9092.I also looked into replacing Redpanda with the official Apache Kafka image. That is possible, but it is not a drop-in swap because the current startup command is Redpanda-specific, so I left that as a separate follow-up.
💚 How did you test it?
./gradlew spotlessApply apiDumppython3 -m py_compile test/system-test-runner.pystart_kafka_broker()now issuesdocker rm -f sentry-java-system-test-kafkabeforedocker run📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
If we want the most official broker image for these tests, switch the runner to
apache/kafkain a separate PR.#skip-changelog